﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using HMI.UIFrms;
namespace HMI.View.SetupFrmTools.LineSetFile
{
    /// <summary>
    /// LineSetItem.xaml 的交互逻辑
    /// </summary>
    public partial class LineSetItem : UserControl
    {
        public LineSetItem()
        {
            InitializeComponent();
        }
        public string Title
        {
            get { return Convert.ToString(nam.Content); }
            set { nam.Content = value; }
        }
        public string TextValue
        {
            get { return Convert.ToString(txt.Text); }
            set { txt.Text = value; }
        }
        public Action<string> SetDValue { get; set; }
        private void btn_Click(object sender, RoutedEventArgs e)
        {
            UIFrms.LineSetBox ls = new UIFrms.LineSetBox();
            ls.WindowStartupLocation = WindowStartupLocation.Manual;
            Point mousePos = this.PointToScreen(Mouse.GetPosition(this));
            ls.Left = mousePos.X;
            ls.Top = mousePos.Y;
            ls.LabelTxt = Title;
            ls.TxtContent = TextValue;
            ls.SetValue = new Action<string>((string str) => {
                TextValue = str;
                if (SetDValue != null)
                    SetDValue(str);
            });
            ls.ShowDialog();
        }
    }
}
